package test.com.sms.selenium.sms.resourcemanagement.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class RmAddCompanyAddAddressPageUtil extends SeleniumPageUtil{
	public final static By ADCA_BUTTON_CONTINUE = By.xpath("//form[@id='subContractorAddress']//*[text()='Continue']");
	public final static By ADCA_BUTTON_CLEAR = By.xpath("//form[@id='subContractorAddress']//*[@value='Clear']");
	public final static By ADCA_BUTTON_CLOSE = By.id("scAddressDialogClose");
	
	public final static By ADCA_LABEL_ADDRESS_TYPE = By.xpath("//*[@id='subContractorAddress']/div[3]/div[1]/div[1]/label");
	public final static By ADCA_SELECT_ADDRESS_TYPE = By.id("addressTypeSubContr");
	public final static By ADCA_LABEL_ADDRESS_NAME = By.xpath("//*[@id='subContractorAddress']/div[3]/div[1]/div[2]/label");
	public final static By ADCA_INPUT_ADDRESS_NAME = By.xpath("//form[@id='subContractorAddress']//*[@id='addressName']");
	public final static By ADCA_LABEL_ADDRESS_LINE_1 = By.xpath("//*[@id='subContractorAddress']/div[3]/div[1]/div[3]/label");
	public final static By ADCA_INPUT_ADDRESS_LINE_1 = By.xpath("//form[@id='subContractorAddress']//*[@id='addressLine1']");
	public final static By ADCA_LABEL_ADDRESS_LINE_2 = By.xpath("//*[@id='subContractorAddress']/div[3]/div[1]/div[4]/label");
	public final static By ADCA_INPUT_ADDRESS_LINE_2 = By.xpath("//form[@id='subContractorAddress']//*[@id='addressLine2']");
	public final static By ADCA_LABEL_ADDRESS_LINE_3 = By.xpath("//*[@id='subContractorAddress']/div[3]/div[1]/div[5]/label");
	public final static By ADCA_INPUT_ADDRESS_LINE_3 = By.xpath("//form[@id='subContractorAddress']//*[@id='addressLine3']");
	public final static By ADCA_INPUT_UNION_SHOP = By.id("unionizedLaborRequiredIndSubContr");
	public final static By ADCA_LABEL_CITY = By.xpath("//*[@id='subContractorAddress']/div[3]/div[2]/div[1]/label");
	public final static By ADCA_INPUT_CITY = By.xpath("//*[@id='subContractorAddress']//input[@id='city']");
	public final static By ADCA_LABEL_STATE = By.xpath("//*[@id='subContractorAddress']/div[3]/div[2]/div[2]/label");
	public final static By ADCA_SELECT_STATE = By.id("stateSubContr");
	public final static By ADCA_LABEL_COUNTRY = By.xpath("//*[@id='subContractorAddress']/div[3]/div[2]/div[3]/label");
	public final static By ADCA_SELECT_COUNTRY = By.id("countrySubContr");
	public final static By ADCA_LABEL_POSTAL_CODE = By.xpath("//*[@id='subContractorAddress']/div[3]/div[2]/div[4]/label");
	public final static By ADCA_INPUT_POSTAL_CODE = By.xpath("//*[@id='subContractorAddress']//input[@id='zipOrPostalCode']");
	public final static By ADCA_LABEL_NUMBER_OF_FES = By.xpath("//*[@id='subContractorAddress']/div[3]/div[2]/div[5]/label");
	public final static By ADCA_INPUT_NUMBER_OF_FES = By.xpath("//*[@id='subContractorAddress']//input[@id='numberOfFEsAtThisLocation']");
	
	// if home base and bill to are not filled, click the save button, a warning window pop-up
	public final static By ADCA_DIV_HOME_BASE_AND_BILL_TO_REQUIRED_WARNING = By.xpath("//*[@id='errorDialog']/div/div");
	public final static By ADCA_BUTTON_COMMIT = By.xpath("html/body/div[7]/div[11]/div/button");
	
	
	public static void waitForAddCompanyAddressPageToLoad(){
		SeleniumUtil.waitOnElements(new By[]{
				ADCA_BUTTON_CONTINUE, ADCA_BUTTON_CLEAR, ADCA_BUTTON_CLOSE, ADCA_LABEL_ADDRESS_TYPE, 
				ADCA_SELECT_ADDRESS_TYPE, ADCA_INPUT_ADDRESS_LINE_1, ADCA_LABEL_CITY, 
				ADCA_INPUT_CITY, ADCA_SELECT_STATE, ADCA_SELECT_COUNTRY, ADCA_INPUT_POSTAL_CODE
		});
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_BUTTON_CONTINUE)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_BUTTON_CLEAR)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_BUTTON_CLOSE)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_LABEL_ADDRESS_TYPE)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_SELECT_ADDRESS_TYPE)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_INPUT_ADDRESS_LINE_1)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_LABEL_CITY)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_INPUT_CITY)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_SELECT_STATE)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_SELECT_COUNTRY)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(ADCA_INPUT_POSTAL_CODE)));
	}
}
